package com.rd.student.dashuju.zhengruixian.test0727;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;

public class TestFileFilter {
    public static void main(String[] args) {
        File file=new File(".");
        String[] nameList=file.list(new MyFilenameFilter());
        for (String s:nameList){
            System.out.println(s);
        }
    }
}
class MyFilenameFilter  implements FilenameFilter{
    @Override
    public boolean accept(File dir,String name){
        if (name.endsWith(".txt")) return true;
        return false;
    }
}
